<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>MyPetstore</title>
</head>

<script type="text/javascript" src="../js/checkOrderInfo.js">
</script>

<body>
<div th:replace="common/admintop"></div>

<div id="Content">

    <div id="BackLink">
        <a href="/admin/viewOrders">Back</a>
    </div>

    <p align="center"><font color="green" th:text="${editMsg}"></font></p>

    <div id="Catalog">
        <form action="/admin/editOrder" method="post">
            <h3>Order Information</h3>
            <table class="rwd-table">
                <tr>
                    <th align="center" colspan="2">
                        <span>Order#</span>
                        <input type="text" style="background-color:transparent;border:0;color:#dd5;font-size:20px" readonly="readonly" th:value="${editOrder.orderId}" name="orderId">
                        <input type="text" style="background-color:transparent;border:0;color:#dd5;font-size:20px" readonly="readonly"
                               th:value="${#dates.format(editOrder.orderDate, 'yyyy/MM/dd hh:mm:ss')}" name="orderDate">
                    </th>
                </tr>
                <tr>
                    <th colspan="2">Payment Details</th>
                </tr>
                <tr>
                    <td>Card Type:</td>
                    <td>
                        <input type="text" th:value="${editOrder.cardType}" name="cardType">
                    </td>
                </tr>
                <tr>
                    <td>Card Number:</td>
                    <td>
                        <input type="text" th:value="${editOrder.creditCard}" name="creditCard">
                    </td>
                </tr>
                <tr>
                    <td>Expiry Date:</td>
                    <td>
                        <input type="text" th:value="${editOrder.expiryDate}" name="expiryDate">
                    </td>
                </tr>
                <tr>
                    <th colspan="2">Billing Address</th>
                </tr>
                <tr>
                    <td>First name:</td>
                    <td>
                        <input type="text" th:value="${editOrder.billToFirstName}" name="billToFirstName">
                    </td>
                </tr>
                <tr>
                    <td>Last name:</td>
                    <td>
                        <input type="text" th:value="${editOrder.billToLastName}" name="billToLastName">
                    </td>
                </tr>
                <tr>
                    <td>Address 1:</td>
                    <td>
                        <input type="text" th:value="${editOrder.billAddress1}" name="billAddress1">
                    </td>
                </tr>
                <tr>
                    <td>Address 2:</td>
                    <td>
                        <input type="text" th:value="${editOrder.billAddress2}" name="billAddress2">
                    </td>
                </tr>
                <tr>
                    <td>City:</td>
                    <td>
                        <input type="text" th:value="${editOrder.billCity}" name="billCity">
                    </td>
                </tr>
                <tr>
                    <td>State:</td>
                    <td>
                        <input type="text" th:value="${editOrder.billState}" name="billState">
                    </td>
                </tr>
                <tr>
                    <td>Zip:</td>
                    <td>
                        <input type="text" th:value="${editOrder.billZip}" name="billZip">
                    </td>
                </tr>
                <tr>
                    <td>Country:</td>
                    <td>
                        <input type="text" th:value="${editOrder.billCountry}" name="billCountry">
                    </td>
                </tr>
                <tr>
                    <th colspan="2">Shipping Address</th>
                </tr>
                <tr>
                    <td>First name:</td>
                    <td>
                        <input type="text" th:value="${editOrder.shipToFirstName}" name="shipToFirstName">
                    </td>
                </tr>
                <tr>
                    <td>Last name:</td>
                    <td>
                        <input type="text" th:value="${editOrder.shipToLastName}" name="shipToLastName">
                    </td>
                </tr>
                <tr>
                    <td>Address 1:</td>
                    <td>
                        <input type="text" th:value="${editOrder.shipAddress1}" name="shipAddress1">
                    </td>
                </tr>
                <tr>
                    <td>Address 2:</td>
                    <td>
                        <input type="text" th:value="${editOrder.shipAddress2}" name="shipAddress2">
                    </td>
                </tr>
                <tr>
                    <td>City:</td>
                    <td>
                        <input type="text" th:value="${editOrder.shipCity}" name="shipCity">
                    </td>
                </tr>
                <tr>
                    <td>State:</td>
                    <td>
                        <input type="text" th:value="${editOrder.shipState}" name="shipState">
                    </td>
                </tr>
                <tr>
                    <td>Zip:</td>
                    <td>
                        <input type="text" th:value="${editOrder.shipZip}" name="shipZip">
                    </td>
                </tr>
                <tr>
                    <td>Country:</td>
                    <td>
                        <input type="text" th:value="${editOrder.shipCountry}" name="shipCountry">
                    </td>
                </tr>
                <tr>
                    <td>Courier:</td>
                    <td>
                        <input type="text" th:value="${editOrder.courier}" name="courier">
                    </td>
                </tr>
                <tr>
                    <td>Status:</td>
                    <td>
                        <input type="text" style="background-color:transparent;border:0;color:#ffffff;font-size:15px" th:value="${editOrder.status}" name="status">
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table class="rwd-table">
                            <tr>
                                <th>Item ID</th>
                                <th>Description</th>
                                <th>Quantity</th>
                                <th>Price</th>
                                <th>Total Cost</th>
                            </tr>
                            <tr th:each="lineItem:${lineItems}">
                                <td th:text="${lineItem.itemId}">
                                    itemId
                                </td>
                                <td>
                                    <span th:text="${lineItem.item.attribute1}">attribute1</span>
                                    <span th:text="${lineItem.item.attribute2}">attribute2</span>
                                    <span th:text="${lineItem.item.attribute3}">attribute3</span>
                                    <span th:text="${lineItem.item.attribute4}">attribute4</span>
                                    <span th:text="${lineItem.item.attribute5}">attribute5</span>
                                    <span th:text="${lineItem.item.product.name}">productname</span>
                                </td>

                                <td th:text="${lineItem.quantity}">quantity</td>
                                <td>
                                    <span>$</span>
                                    <span th:text="${#numbers.formatDecimal(lineItem.unitPrice,1,'COMMA',2,'POINT')}"></span>
                                </td>
                                <td>
                                    <span>$</span>
                                    <span th:text="${#numbers.formatDecimal(lineItem.total,1,'COMMA',2,'POINT')}"></span>
                                </td>
                            </tr>
                            <tr>
                                <th colspan="5">Total:
                                    <span>$</span>
                                    <span th:text="${#numbers.formatDecimal(editOrder.totalPrice,1,'COMMA',2,'POINT')}"></span>
                                </th>
                            </tr>
                        </table>
                    </td>
                </tr>

            </table>
            <p align="center"><font color="red" name="errormsg"></font></p>
            <input onclick=" return check()" type="submit" name="editOrder" value="Save Order Information"/>
        </form>

    </div>
</div>

<div th:replace="common/bottom"></div>
</body>
</html>